//
//  UIView+coordinates.m
//  BabyCloudForTeachers
//
//  Created by mac on 2017/5/25.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "UIView+coordinates.h"

@implementation UIView (coordinates)

//-(CGFloat)cc_x{
//    return self.frame.origin.x;
//}
//
//-(CGFloat)cc_y{
//    return self.frame.origin.y;
//}
//
//-(CGFloat)cc_width{
//    return self.frame.size.width;
//}
//
//-(CGFloat)cc_height{
//    return self.frame.size.height;
//}
//
//-(CGPoint)cc_origin{
//    return self.frame.origin;
//}
//
//-(CGSize)cc_size{
//    return self.frame.size;
//}
//
//
//
//-(void)setCc_x:(CGFloat)cc_x{
//    self.frame = (CGRect){CGPointMake(cc_x, self.frame.origin.y),[self size]};
//}
//
//-(void)setCc_y:(CGFloat)cc_y{
//    self.frame = (CGRect){CGPointMake(self.frame.origin.x, CC_FRAME_NAV_X(cc_y)),[self size]};
//}
//
//-(void)setCc_width:(CGFloat)cc_width{
//    self.frame = (CGRect){[self origin],CGSizeMake(cc_width, self.frame.size.height)};
//}
//
//-(void)setCc_height:(CGFloat)cc_height{
//    self.frame = (CGRect){[self origin],CGSizeMake(self.frame.size.width, cc_height)};
//}
//
//-(void)setCc_origin:(CGPoint)cc_origin{
//    self.frame = (CGRect){cc_origin,[self size]};
//}
//
//-(void)setCc_size:(CGSize)cc_size{
//    self.frame= (CGRect){[self origin],cc_size};
//}
//
//-(CGFloat)cc_cor{
//    return self.layer.cornerRadius;
//}
//-(void)setCc_cor:(CGFloat)cc_cor{
//    self.layer.cornerRadius = cc_cor;
//    self.clipsToBounds = YES;
//}
//
//
//-(CGFloat)bottomForWindow{
//    CGRect frame = [self.superview convertRect:self.frame toView:nil];
//    return frame.size.height + frame.origin.y;
//}


- (void)removeAllSubViews{
    while (self.subviews.lastObject) {
        [self.subviews.lastObject removeFromSuperview];
    }
}

- (void)addArc:(UIRectCorner)corners withRad:(CGFloat)rad{
    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:corners cornerRadii:CGSizeMake(rad, rad)];
    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
    maskLayer.frame = self.bounds;
    maskLayer.path = maskPath.CGPath;
    self.layer.mask = maskLayer;
}

@end
